{extend name="base" /}
{block name="body"}
<div class="layui-card">
  <div class="layui-card-body">
    <blockquote class="layui-elem-quote layui-text">
        商品规格：<span class="text-danger">灰色</span>规格属性为<span class="text-danger">禁用状态</span>规格有子规格时，无法<span class="text-danger">删除</span>，添加完规格后需要再次添加商品类型方可使用。如果同一类型商品存在多规格，则添加类型时选择多规格。例：衣服类型，需要选中<span class="text-danger">颜色、尺码</span>等
    </blockquote>
    <div class="layui-form-item">
      <button class="layui-btn layui-btn-normal open-popup" data-title="{$Think.lang.add}" data-url="{:url('add')}"><i class="fa fa-plus"></i>{$Think.lang.add}</button>
      <button class="layui-btn layui-btn-{empty name='list'}primary{else}normal open-popup{/empty}" data-title="商品类型" data-url="{:url('goodgroup/lists')}"><i class="fa fa-database"></i>商品模型</button>
    </div>
        <table class="layui-table layui-form" lay-skin="line">
            <thead>
                <tr>
                    <th>{$Think.lang.id}</th>
                    <th>{$Think.lang.name}</th>
                    <th>{$Think.lang.sku}</th>
                    <th>{$Think.lang.createTime}</th>
                    <th>{$Think.lang.status}</th>
                    <th>{$Think.lang.handle}</th>
                </tr>
            </thead>
            <tbody>
                {volist name="list" id="v" key="k" empty="$empty"}
                <tr>
                    <td>{$k}</td>
                    <td>{$v.name}</td>
                    <td>{if isset($v.children)}
                        {volist name="$v.children" id="vo"}
                            <button class="layui-btn layui-btn-{eq name='vo.status' value='0'}disabled{else}warm{/eq} layui-btn-xs open-popup" data-title="{$vo.name}" data-url="{:url('edit', ['id' => $vo.id])}">{$vo.name}</button>
                        {/volist}
                    {/if}
                    </td>
                    <td>{$v.create_time}</td>
                    <td><input type="checkbox" name="status" value="{$v.id}" lay-skin="switch" lay-filter="*" lay-text="开启|禁用" data-url="{:url('edit')}" {if $v.status eq 1}checked{/if}></td>
                    <td>
                        <button class="layui-btn layui-btn-xs open-popup" data-title="{$Think.lang.edit}" data-url="{:url('edit', ['id' => $v.id])}"><i class="fa fa-edit"></i>{$Think.lang.edit}</button>
                        <button class="layui-btn layui-btn-danger ajax-del layui-btn-xs" data-title="{$Think.lang.drop}" data-url="{:url('del', ['id' => $v.id])}"><i class="fa fa-trash-o"></i>{$Think.lang.drop}</button>
                    </td>
                </tr>
                {/volist}
            </tbody>
        </table>
    </div>
</div>
{/block}
{block name="js"}
{/block}